"use strict";

var username = document.getElementById("regin1");
var password = document.getElementById("regin2");
var btn = document.getElementById("regin3");

btn.onclick = function () {
  var us = username.value;
  var ps = password.value;
  var regAPI = "http://jx.xuzhixiang.top/ap/api/reg.php";
  axios.get(regAPI, {
    params: {
      username: us,
      password: ps
    }
  }).then(function (res) {
    //请求成功
    console.log(res.data);
    alert(res.data.msg); //如果请求成功则跳转

    if (res.data.code == 1) {
      location.href = "login.html";
    }
  })["catch"](function (err) {
    //请求失败
    // console.log(err.data.msg);
    alert(err.data.msg);
  });
};